/**
 * 
 */
package com.miolr.core.service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.miolr.core.dao.GenericDao;
import com.miolr.core.query.PageModel;

/**
 * @author iday
 *
 */
public interface GenericService<D extends GenericDao<T>, T> {

	public abstract T findByPrimaryKey(Serializable key);

	public abstract List<T> findAll();

	public abstract void save(T obj);

	public abstract void update(T obj);

	public abstract void update(T obj, String[] ignored);
	
	public abstract void merge(T t);

	public abstract void saveOrUpdate(Collection<T> c);

	public abstract void deleteByPrimaryKey(Serializable key);

	public abstract void delete(T obj);

	public abstract void deleteAll(Collection<T> c);

	public abstract List<T> queryAll(String sql, boolean cached);

	public abstract List<T> queryAll(String sql);

	public abstract List<T> queryAll(String sql, PageModel pm, boolean cached);

	public abstract List<T> queryAll(String sql, PageModel pm);

	public abstract List<T> queryAll(DetachedCriteria detachedCriteria, PageModel pm, boolean cached,
			String cacheRegion);

	public abstract List<T> queryAll(PageModel pm, boolean cached, String cacheRegion);

	public abstract T findByPrimaryKey(Serializable key, String...nestedNames);

}
